import 'package:flutter/material.dart';

class TestInfoPage extends StatelessWidget {
  const TestInfoPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('测试账号信息'),
        backgroundColor: Theme.of(context).primaryColor,
        foregroundColor: Colors.white,
        elevation: 0,
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const Text(
              '测试环境账号信息',
              style: TextStyle(
                fontSize: 24,
                fontWeight: FontWeight.bold,
                color: Colors.black87,
              ),
            ),
            const SizedBox(height: 20),

            // 手机号登录测试账号
            _buildTestCard(
              title: '手机号登录',
              items: const [
                '手机号：13800138000',
                '验证码：123456',
                '说明：输入任意手机号，验证码固定为 123456',
              ],
              color: Colors.blue[50]!,
            ),

            const SizedBox(height: 16),

            // 账号密码登录测试账号
            _buildTestCard(
              title: '账号密码登录',
              items: const [
                '用户名：test',
                '密码：123456',
                '说明：使用固定账号密码进行测试',
              ],
              color: Colors.green[50]!,
            ),

            const SizedBox(height: 16),

            // 注册测试信息
            _buildTestCard(
              title: '注册流程',
              items: const [
                '第一步：输入任意手机号，验证码为 123456',
                '第二步：填写个人信息、技能等',
                '说明：注册完成后会跳转到首页',
              ],
              color: Colors.orange[50]!,
            ),

            const SizedBox(height: 20),

            // 注意事项
            Container(
              padding: const EdgeInsets.all(16),
              decoration: BoxDecoration(
                color: Colors.red[50],
                borderRadius: BorderRadius.circular(12),
                border: Border.all(color: Colors.red[200]!),
              ),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Row(
                    children: [
                      Icon(Icons.info, color: Colors.red[600]),
                      const SizedBox(width: 8),
                      Text(
                        '注意事项',
                        style: TextStyle(
                          fontSize: 18,
                          fontWeight: FontWeight.bold,
                          color: Colors.red[600],
                        ),
                      ),
                    ],
                  ),
                  const SizedBox(height: 8),
                  Text(
                    '• 当前为测试环境，没有真实的短信发送功能\n'
                    '• 所有验证码都是固定的 123456\n'
                    '• 数据不会真实保存，仅用于界面演示\n'
                    '• 生产环境需要集成真实的短信服务',
                    style: TextStyle(
                      fontSize: 14,
                      color: Colors.red[700],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

  Widget _buildTestCard({
    required String title,
    required List<String> items,
    required Color color,
  }) {
    return Container(
      padding: const EdgeInsets.all(16),
      decoration: BoxDecoration(
        color: color,
        borderRadius: BorderRadius.circular(12),
        border: Border.all(color: color.withOpacity(0.3)),
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(
            title,
            style: const TextStyle(
              fontSize: 18,
              fontWeight: FontWeight.bold,
              color: Colors.black87,
            ),
          ),
          const SizedBox(height: 12),
          ...items.map((item) => Padding(
                padding: const EdgeInsets.only(bottom: 4),
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    const Text('• ', style: TextStyle(fontSize: 16)),
                    Expanded(
                      child: Text(
                        item,
                        style: const TextStyle(fontSize: 14),
                      ),
                    ),
                  ],
                ),
              )),
        ],
      ),
    );
  }
}
